<template>
    <div class="flex_center">
      <div style="width: 40%;margin-bottom: 30px">
        <el-input style="border: 2px solid red;" placeholder="请输入内容" v-model="queryInfo.query" clearable @clear="getGoodsList">
          <template slot="append">
            <el-button  @click="getGoodsList" style="background-color: red;color: white;">搜索</el-button>
          </template>
        </el-input>
      </div>
      <router-view></router-view>
    </div>
</template>

<script>
export default {
  name: 'Welcome',
  data () {
    return {
      // 获取用户列表的参数对象
      queryInfo: {
        query: '',
        pagenum: 1,
        pagesize: 10
      }
    }
  },
  methods: {
    // /*按照指定关键词搜索商品或分类*/
    getGoodsList () {
      this.$axios.get('goods/', {params: this.queryInfo})
        .then(resp => {
          if (resp && resp.data.status !== 200) {
            return this.$message.error('获取具体商品失败!')
          }
          this.$message.success('获取具体商品成功!')
          console.log(resp.data.data.date)
          this.specialGoodsList = resp.data.data.data
        })
    }
  }
}
</script>

<style scoped>
.flex_center{
  display: flex;
  justify-content: center;
  align-content:center;
  align-items:center;
  flex-flow: column;
}
</style>
